﻿using Device.Domain;
using Device.Infrstructre.Interface;
using Device.Read.API.Applcation.Command.UnitCommand;
using MediatR;

namespace Device.Read.API.Applcation.CommandHandlers.UnitCommandHandlers
{
    /// <summary>
    /// 反填单位管理
    /// </summary>
    public class UnitFanCommandHandler:IRequestHandler<UnitFanCommand, UnitModel>
    {
        private readonly IUnitRepository _unitRep;
        public UnitFanCommandHandler(IUnitRepository _unitRep)
        {
            this._unitRep = _unitRep;
        }

        public async Task<UnitModel> Handle(UnitFanCommand request, CancellationToken cancellationToken)
        {
            return await _unitRep.GetModelAsync(request.UnitId);
        }
    }
}
